<!--#include file="lib/utf-8.asp"-->
<!--#include file="lib/conn.asp"-->
<!--#include file="lib/saferequest.asp"-->
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="Expires" content="-1" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true&language=zh-CN"></script>
<script type="text/javascript" src="lib/jquery_lastest.js"></script>
<script type="text/javascript">
	$(function() {
			$("#sidebar").show();
		$("#map_canvas").css("margin","0 0 0 200px");

		var map;
		var myLatlng;
		var myLat=29.868336;
		var myLng=121.54399;
		var myZoom=10;
		var marker;
		var infowindow;
		//地图初始化
		myLatlng = new google.maps.LatLng(myLat,myLng );
		var mapOptions = {
			zoom: myZoom,                //缩放级别
			center: myLatlng,       //将地图的中心设置为指定的地理点 可以使用 0（最低缩放级别，在地图上可以看到整个世界）到 19（最高缩放级别，可以看到独立建筑物）之间的缩放级别
			mapTypeId: google.maps.MapTypeId.ROADMAP,   //ROADMAP-默认视图 SATELLITE-显示Google地球卫星图像 HYBRID-混合显示普通视图和卫星视图 TERRAIN-地形图
			mapTypeControl: true,
			mapTypeControlOptions: {
				style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
			},
			navigationControl: true,
			navigationControlOptions: {
				style: google.maps.NavigationControlStyle.SMALL,
				position: google.maps.ControlPosition.LEFT
			},
			scaleControl: true,    //比例尺
			scaleControlOptions: {
				position: google.maps.ControlPosition.BOTTOM_LEFT
			}
		};
		map = new google.maps.Map(document.getElementById("map_canvas"),mapOptions);//编写 JavaScript 函数创建“map”对象
		$.getJSON("readUsergeo.asp",{usergeo_user:"6874612434586956519"},function(json){
			var s=n= 31.1615266;
			var e=w= 121.3943522;
			$.each(json,function(i,item){
				myLatlng = new google.maps.LatLng(item.usergeo_lat,item.usergeo_lng );
				if(item.usergeo_lat>n){n=item.usergeo_lat;}
				if(item.usergeo_lat<s){s=item.usergeo_lat;}
				if(item.usergeo_lng>e){e=item.usergeo_lng;}
				if(item.usergeo_lng<w){w=item.usergeo_lng;}
				marker=new google.maps.Marker();
				marker.setOptions({
					map: map,
					position: myLatlng,
					title:item.usergeo_reverse
				});
			
			});
			var southWest = new google.maps.LatLng(s,w);
			var northEast = new google.maps.LatLng(n,e);
		
			var bounds = new google.maps.LatLngBounds(southWest,northEast);
			map.fitBounds(bounds);

			
		});

		infowindow = new google.maps.InfoWindow();
		var contentString = '<div id="content">'+
			'<h1 id="firstHeading">'+item.usergeo_user+'</h1>'+
			'<div id="bodyContent">'+
			'<p>地址：' +item.usergeo_timestamp+'</p>'+
			'<p>联系人：' +$("#customer_owner").val()+'</p>'+
			'<p>联系电话：' +$("#customer_phone").val()+'</p>'+
			'<p>注意事项：' +$("#customer_memo").val()+'</p>'+
			'</div>'+
			'</div>';
		infowindow.setOptions({
				content: contentString
		});

		google.maps.event.addListener(marker, 'click', function() {
			infowindow.open(map,marker);
		});
	
	});
</script>	
</head>
<body>
<div>
<div id="sidebar"></div>
<div id="map_canvas" style="width: 100%; height: 800px"></div>
</div>
<%
usergeo_user=saferequest("usergeo_user",0)
set rs = Server.CreateObject("ADODB.Recordset")
if usergeo_user<>"" then 
	sql="select * from usergeo where usergeo_user='"&usergeo_user&"' order by usergeo_id desc"
else
	sql="select * from usergeo order by usergeo_id desc"
end if
rs.open sql,conn,1,1
'response.write(sql)
do while not rs.eof
%>
<div><%=rs("usergeo_user")%>&nbsp;<%=rs("usergeo_lat")%>&nbsp;<%=rs("usergeo_lng")%>&nbsp;<%=rs("usergeo_timestamp")%>&nbsp;<%=rs("usergeo_inmeters")%>&nbsp;<%=rs("usergeo_reverse")%>&nbsp;<%=rs("usergeo_update")%></div>
<%
	
	rs.movenext
loop


	
rs.close
conn.close
set conn=nothing

%>
</body>
</html>
